package com.zh;

/**
 * Created by zhaohui on 2019/9/9
 * Description:
 */
public class Insertion extends Example {

    @Override
    public void sort(Comparable[] a) {
        int N = a.length;
        for (int i = 1; i < N; i++) {
            for (int j = i; j > 0 && less(a[j], a[j-1]); j--) {
                exch(a, j, j-1);
            }
        }
    }


    public static void main(String[] args) {
        Insertion insertion = new Insertion();
        insertion.test();
    }

}
